package com.zszq.ms.bigmodeltest.controller;

import com.zszq.ms.bigmodeltest.domain.response.Result;
import com.zszq.ms.bigmodeltest.entity.AiTask;
import com.zszq.ms.bigmodeltest.service.AiTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 主任务控制器
 *
 * @author ms
 * @since 2025-03-31
 */
@RestController
@RequestMapping("/aiTask")
public class AiTaskController {
    @Autowired
    private AiTaskService aiTaskService;

    @GetMapping("/executeTask/{id}")
    public Result executeTask(@PathVariable String id) {
        return aiTaskService.executeTask(id);
    }

    @PostMapping("/add")
    public Result add(@RequestBody AiTask aiTask) {
        return Result.success(aiTaskService.add(aiTask));
    }

    @PostMapping("/update")
    public Result update(@RequestBody AiTask aiTask) {
        return Result.success(aiTaskService.update(aiTask));
    }
}
